<?php /* Smarty version Smarty-3.1.13, created on 2013-07-02 07:11:04
         compiled from ".\templates\bill.tpl" */ ?>
<?php /*%%SmartyHeaderCode:10249517f68576a2716-41881251%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'c47cd0ea281471e352f01f3c7cada7b04bb39e56' => 
    array (
      0 => '.\\templates\\bill.tpl',
      1 => 1368710283,
      2 => 'file',
    ),
    '9d3840acd837a27297ba054f8bc546ea8525850a' => 
    array (
      0 => 'D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\hirenbhai\\templates\\main.tpl',
      1 => 1372739455,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '10249517f68576a2716-41881251',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.13',
  'unifunc' => 'content_517f685779d072_29490559',
  'variables' => 
  array (
    's_activId' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_517f685779d072_29490559')) {function content_517f685779d072_29490559($_smarty_tpl) {?><?php if (!is_callable('smarty_function_html_options')) include 'D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\hirenbhai\\include\\smarty\\libs\\plugins\\function.html_options.php';
if (!is_callable('smarty_function_html_select_date')) include 'D:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\hirenbhai\\include\\smarty\\libs\\plugins\\function.html_select_date.php';
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title>!! HIRENBHAI !!</title>
<link rel="stylesheet" type="text/css" href="./css/main.css" />
<link rel="stylesheet" type="text/css" href="./css/style.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<link rel="stylesheet" href="css/style1.css" media="screen">
	<style type="text/css">
		html, body { margin: 0;	padding: 0; }
		ul.menu { margin: 0px auto 0 auto; }
	</style>
	</head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
 $(document).ready(function() {
	$("#partyId").focus();
	$(".add").blur(function()
	{
	  if($(".add:last").val() != '' && $(".add:last").val() > 0)
	  {
      $("#one").clone(true).appendTo("#mainDiv")
      .find('input[type="text"]').val('').end()
      .find('select[option=""]').val('');
      var rowCount = $('#mainDiv tr').length;
      $(".srno:last").val(rowCount);
    }
  });
});
  function itemAjax(itemVal)
  {
  	var row = $(itemVal).parents('.one');
  	$.ajax({
  	  url:'ajaxRisponceItem.php',
  	  data:'itemVal='+itemVal,
  	  dataType:'HTML',
  	  type:'POST',
  	  
  	  success:function(msg){
  	  	$('.sizeSelect:last').html(msg);
  	  }
    });
  }
  
  function sizeAjax(sizeVal)
  {
  	var row = $(sizeVal).parents('.one');
    var itemVal = $("#itemSelect").val();
    var dataString = 'sizeVal='+sizeVal + '&itemVal=' + itemVal;
    $.ajax({
  	  url:'ajexResponceSize.php',
      data: dataString,
  	  dataType:'HTML',
  	  type:'POST',
  	  
  	  success:function(msg){
  	  	$('.companySelect:last').html(msg);
  	  }
    });
  }
  
  function companyAjax(companyVal)  {
  	var row = $(companyVal).parents('#one');
  	var itemVal = $("#itemSelect").val();
  	var sizeVal = $("#sizeSelect").val();
  	var dataString = 'companyVal='+companyVal + '&itemVal=' + itemVal + '&sizeVal=' + sizeVal ;
  	$.ajax({
  	  url:'ajaxRisponceIcompany.php',
      data: dataString,
  	  dataType:'HTML',
  	  type:'POST',
  	  
  	  success:function(msg){
  	  	$('#qualitySelect:last').html(msg);
  	  }
    });
  }
  
  function qualityAjax(qualityVal)
  {
  	var row = $(qualityVal).parents('#one');
  	var itemVal = $("#itemSelect").val();
  	var sizeVal = $("#sizeSelect").val();
  	var companyVal = $("#companySelect").val();
  	var dataString = '&qualityVal='+ qualityVal + '&companyVal='+ companyVal + '&itemVal=' + itemVal + '&sizeVal=' + sizeVal ;
  	$.ajax({
  	  url:'ajaxResponceQuality.php',
      data: dataString,
  	  dataType:'HTML',
  	  type:'POST',
  	  
  	  success:function(msg){
  	  	$('#colorSelect:last').html(msg);
  	  }
    });
  }
  function myFunction()
  {
    if(confirm("You Want To Remove This Record")== true)
	  {
		  return true;
	  }
	  else
	  {
		  return false;
	  }
  }

function setAmount(rateObj)
{
	var row = $(rateObj).parents('.one');
	var quantity = parseFloat($(row).find('#quantity').val());
	var rate     = parseFloat($(rateObj).val());
	var amount = 0;

	if(!isNaN(quantity) && !isNaN(rate))
	{
		amount = (quantity * rate);
		row.find('.amount').val(amount.toFixed(2));
	}
	else
		row.find('.amount').val('');
}

function setColumnTotal()
{
  var totalQty    = 0;
  var totalAmount = 0;	
  
  $('.quantity').each(function(i)
  {
    quantity = $(this).val().replace("$","");
    if(!isNaN(quantity))
    {
    	totalQty+= Number(quantity);
    }
  }); 
    
  $('.amount').each(function(i)
  {
    amount = $(this).val().replace("$","");
    if(!isNaN(amount))
    {
    	totalAmount+= Number(amount);
    }
  });

  $('#totalQty').val(totalQty.toFixed(0));
  $('#totalAmount').val(totalAmount.toFixed(2));
}
</script>



<?php if (strlen($_smarty_tpl->tpl_vars['s_activId']->value)>0){?>
<div id="headerContent">
  <div id="headingData"><br>
    <a href="bill.php"></a>
  </div>
</div>
<body>
  <ul class="menu">
    <li><a href="#"> Master</a>
      <ul>
        <li><a href="item.php" align="left"> Item</a></li>
        <li><a href="size.php"  align="left">Size</a></li>
        <li><a href="company.php"  align="left">Company</a></li>
        <li><a href="quality.php"  align="left">Quality</a></li>
        <li><a href="itemCreate.php"  align="left">Color</a></li>
        <li><a href="itemImage.php"  align="left">Item Image</a></li>
        <li><a href="transaction.php"  align="left">Transaction</a></li>
      </ul>
    </li>
    <li><a href="party.php">Party</a><li>
    <li><a href="partyType.php">Transaction</a><li>
    <li><a href="order.php"> Order</a><li>
    <li><a href="orderlist.php"> Order List</a><li>
    <li><a href="bill.php">Bill</a></li>
    <li><a href="logout.php">Logout</a><li>
  </ul>
</body>
<?php }?>

<form name="party" action="<?php echo $_SERVER['PHP_SELF'];?>
" method="POST">
<table align="center" border="1" cellpadding="2" cellspacing="2">
  <tr>
    <td align="center" class="table1" colspan="4">Bill Entry</td>
  </tr>
  <tr>
    <td class="table2" align="right">PartyName
  	  <select name="partyId" id="partyId">
  	    <option value="" id="partyId">Select</option>
  	    <?php echo smarty_function_html_options(array('values'=>$_smarty_tpl->tpl_vars['partyArray']->value['partyId'],'output'=>$_smarty_tpl->tpl_vars['partyArray']->value['partyName']),$_smarty_tpl);?>

      </select>
    </td>
    <!--<input type="text" name="partyName" autofocus=autofocus required=""required>-->
    <th class="table2">Date :
      <?php echo smarty_function_html_select_date(array('prefix'=>"billDate",'start_year'=>"-0",'end_year'=>"+2",'field_order'=>"DMY",'month_format'=>"%m",'day_value_format'=>"%02d"),$_smarty_tpl);?>

    </th>
  </tr>
</table>
<table align="center" border="1" cellpadding="2" cellspacing="2" width="" >
  <tr>
    <th class="table2">Sr No</th>
    <th class="table2">Item</th>
    <th class="table2">Size</th>
    <th class="table2">Company</th>
    <th class="table2">Quality</th>
    <th class="table2">Color</th>
    <th class="table2">Quantity</th>
    <th class="table2">Rate</th>
    <th class="table2">Amount</th>
  </tr>
  <tbody id="mainDiv">
<!--===========Item Select box ===============-->	
    <tr id="one" class="one">
      <td><input type="text" name="srno[]" id="srno[]" class="srno" size="3" value="1" disabled />
      </td>
      <td align="center" class="table2">
	      <select name="itemId[]" id="itemSelect"  onchange="itemAjax(this.value)">
	        <option value="0">Select Item</option>
	        <?php echo smarty_function_html_options(array('values'=>$_smarty_tpl->tpl_vars['itemArray']->value['itemId'],'output'=>$_smarty_tpl->tpl_vars['itemArray']->value['itemName']),$_smarty_tpl);?>

        </select>
      </td>
<!--===========Size Select box ===============-->
      <td align="center" class="table2">
        <select name="sizeId[]" id="sizeSelect" class="sizeSelect" onchange="sizeAjax(this.value)">
      	  <option value="0">Select Size</option>
        </select>
      </td>
<!--===========Company Select box ===============-->
      <td align="center" class="table2">
	      <select name="companyId[]" id="companySelect" class="add companySelect" onchange="companyAjax(this.value)">
	        <option value="0">Select Company</option>
        </select> 
      </td>
<!--===========Quality Select box ===============-->
      <td align="center" class="table2">
	      <select name="qualityId[]" id="qualitySelect" onchange="qualityAjax(this.value)">
	        <option value="0">Select Quality</option>
        </select>
      </td>
<!--===========Color Select box ===============-->
      <td align="center" class="table2">
	      <select name="colorId[]" id="colorSelect">
	        <option value="0">Select Color</option>
        </select>
      </td>
      <td class="table2"><input type="text" name="qty" id="quantity" class="quantity" value="" Size="3" onblur="setColumnTotal();" /></td>
      <td class="table2"><input type="text" name="rate" value="" onblur="setAmount(this); setColumnTotal();" /></td>
      <td class="table2"><input type="text" name="amount" class="amount" value="" onblur="setColumnTotal();" /></td>
    </tr>
  </tbody>
  <tr>
  	<td class="table2" colspan="6">Total</td>
    <td class="table2"><input type="text" Size="3" id="totalQty" DISABLED /></td>
    <td class="table2">&nbsp;</td>
    <td class="table2"><input type="text" id="totalAmount" DISABLED /></td>
  </tr>
  <tr>
    <td class="table1" align="center" colspan="9" ><input type="submit" name="submit" value="Submit" class="button" /></td>
  </tr>
  </table>
  </form>

</body>
</html><?php }} ?>